home *** CD-ROM | disk | FTP | other *** search
- TExec Component for Delphi.
- Uploaded by 100524,2162 Dave Taylor.
-
- Component to run another Windows app.
- Runs WINEXEC. Progname & params specified in strings
- can wait for app to complete, before continuing.
-
- Source code is in DEXEC.PAS
- Toolbar icon is in DEXEC.DCR
-
- Use Delphi main screen 'Options' to Install the component.
- Appears on 'System' toolbar
-
- Properties:
-
- .Progname = Drive/Directory/Name of program to execute
- .Progparams = Optional parameters for program
- .Show = Normal, Minimized, Maximized
-
- .Wait = True causes wait for called task to finish before return
- .Wait = False returns immediately
-
- .Timeout = 0 (When Wait=True, waits until called program is closed)
- .Timeout = n (When Wait=True, returns after n seconds even if program is still running)
-
- Feedback:
-
- .ReturnCode = 0 everything happened OK
- .ReturnCode = 1 error
- .ReturnCode = 2 timeout occured
-
- .Reasoncode = n (when .ReturnCode = 1 gives windows error code)
- .Message = text (when .ReturnCode = 1 gives meaning of error code)
-
- .Instance (If exec worked, instance of started task)
-
- Methods:
-
- .Exec Runs the command
-
- Example:
-
- Exec1.Progname:='NOTEPAD.EXE';
- Exec1.Progparams:='WIN.INI';
- Exec1.Show:=Normal;
- Exec1.Wait:=True;
- Exec1.Timeout:=30;
- Exec1.Exec;
-
- Runs NOTEPAD to edit WIN.INI.
- Waits until NOTEPAD is closed or 30 seconds elapsed before returning.
-
- Note: you should maybe hide or disable the form before using Exec with Wait=True ?
-
- or
-
- var p1,p2: array [0..255] of char;
- begin
- exec1.progname:='c:\windows\notepad.exe';
- exec1.exec;
- if exec1.returncode<>0 then
- messagebox(form1.handle,strpcopy(p1,exec1.message),strpcopy(p2,'myapp'),mb_iconstop+mb_ok);
- end;